<?php
/*
File: contest.php
Version: 2.0
Date created: 
Last Edited : 26-07-2008
Author: Craig G Smith<craig@joomla-host.co.za
*/

  defined( 'JOSCOM_VERSION' ) or die( 'Direct Access to this location is not allowed.' );
  if (defined( '_OSCOMMERCE_LOADED' )) {
    if (!DB_SHARED) {
      tep_db_connect() or die('Unable to connect to database server!');
    }
    global $category_links, $languages_id, $cPath, $cPath_array, $current_category_id;
    global $request_type, $lng, $cart, $currencies, $language, $navigation, $breadcrumb;
  } else {
    require(DIR_WS_COMPONENT . 'includes/application_top.php');
  }

  $action = (isset($_REQUEST['action']) ? $_REQUEST['action'] : '');

  if (tep_not_null($action)) {
    switch ($action) {
      case 'setflag':
        if ( ($_REQUEST['flag'] == '0') || ($_REQUEST['flag'] == '1') ) {
          if (isset($_REQUEST['pID'])) {
            tep_set_entry_status($_REQUEST['pID'], $_REQUEST['flag']);
          }
        }
        tep_redirect(tep_href_link(FILENAME_CONTEST, 'cPath=' . $_REQUEST['cPath'] . '&pID=' . $_REQUEST['pID']));
        break;

      case 'update':
        $entry_id = tep_db_prepare_input($_REQUEST['eID']);
        $contestants_name = tep_db_prepare_input($_REQUEST['contestants_name']);
        $contestants_email = tep_db_prepare_input($_REQUEST['contestants_email']);
		$contestants_location = tep_db_prepare_input($_REQUEST['contestants_location']);
		$entry_status = tep_db_prepare_input($_REQUEST['entry_status']);
		$entry_text = tep_db_prepare_input($_REQUEST['entry_text']);

        tep_db_query("update " . TABLE_CONTEST . " set contestants_name = '" . tep_db_input($contestants_name) . "', contestants_email = '" . tep_db_input($contestants_email) . "', contestants_location = '" . tep_db_input($contestants_location) . "', entry_status = '" . tep_db_input($entry_status) . "', last_modified = now() where entry_id = '" . (int)$entry_id . "'");
        tep_db_query("update " . TABLE_ENTER_CONTEST_DESCRIPTION . " set entry_text = '" . tep_db_input($entry_text) . "' where entry_id = '" . (int)$entry_id . "'");

        tep_redirect(tep_href_link(FILENAME_CONTEST, 'page=' . $_REQUEST['page'] . '&eID=' . $entry_id));
        break;

      case 'deleteconfirm':
        $entry_id = tep_db_prepare_input($_REQUEST['eID']);

        tep_db_query("delete from " . TABLE_CONTEST . " where entry_id = '" . (int)$entry_id . "'");
        tep_db_query("delete from " . TABLE_ENTER_CONTEST_DESCRIPTION . " where entry_id = '" . (int)$entry_id . "'");

        tep_redirect(tep_href_link(FILENAME_CONTEST, 'page=' . $_REQUEST['page']));
        break;
    }
  }
?>
<link rel="stylesheet" type="text/css" href="<?php echo DIR_WS_COMPONENT ?>includes/stylesheet.css">
<script language="javascript" src="<?php echo DIR_WS_COMPONENT ?>includes/general.js"></script>
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2" class="adminlist">
  <tr>
    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
    </table></td>
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
            <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
          </tr>
        </table></td>
      </tr>
<?php
  if ($action == 'edit') {
    $eID = tep_db_prepare_input($_REQUEST['eID']);

    $contest_query = tep_db_query("select l.name as contest_languages_name, g.entry_id, g.contestants_name, g.contestants_email, g.contestants_location, g.entry_status, g.date_added, gd.entry_text, g.last_modified from " . TABLE_LANGUAGES . " l, " . TABLE_CONTEST . " g, " . TABLE_ENTER_CONTEST_DESCRIPTION . " gd where g.entry_id = '" . (int)$eID . "' and g.entry_id = gd.entry_id and l.languages_id = gd.languages_id");
    $contest = tep_db_fetch_array($contest_query);

    $gInfo_array = array_merge($contest, $contest_description);
    $gInfo = new objectInfo($gInfo_array);
	
	if (!isset($gInfo->entry_status)) $gInfo->entry_status = '1';
    switch ($gInfo->entry_status) {
      case '0': $in_status = false; $out_status = true; break;
      case '1':
      default: $in_status = true; $out_status = false;
    }
	
?>

	  <tr>
		<td><table border="0" width="95%" align="center" cellspacing="1" cellpadding="2"><?php echo tep_draw_form('contest', 'index3.php?option=com_oscommerce&osMod=contest&page=' . $_REQUEST['page'] . '&eID=' . $_REQUEST['eID'] . '&action=preview'); ?>
      
           <tr> 
             <td class="main"><b><?php echo DISPLAY_ENTRY; ?></b>&nbsp;<?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . tep_draw_radio_field('entry_status', '1', $in_status) . '&nbsp;' . ENTRY_YES . '&nbsp;' . '&nbsp;' . '&nbsp;' . tep_draw_radio_field('entry_status', '0', $out_status) . '&nbsp;' . ENTRY_NO; ?></td>
           </tr>
           <tr> 
             <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
           </tr>
		   <tr> 
             <td class="main"><b><?php echo DATE_ENTRY; ?></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo tep_date_long($gInfo->date_added); ?></td>
           </tr>
           <tr> 
             <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
           </tr>
           <tr> 
             <td class="main"><b><?php echo CONTESTANT_ENTRY; ?></b>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('contestants_name', $gInfo->contestants_name, 'size="24"'); ?></td>
           </tr>
           <tr> 
             <td class="main"><b><?php echo EMAIL_ENTRY; ?></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('contestants_email', $gInfo->contestants_email, 'size="32"'); ?></td>
           </tr>
           <tr> 
             <td class="main"><b><?php echo LOCATION_ENTRY; ?></b>&nbsp;<?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('contestants_location', $gInfo->contestants_location, 'size="32"'); ?></td>
           </tr>
           <tr> 
             <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
           </tr>
		   <tr> 
             <td class="main" colspan="2"><b><?php echo LANGUAGES_NAME_ENTRY; ?></b>&nbsp;&nbsp;<?php echo $gInfo->contest_languages_name; ?></td>
           </tr>
		   <tr> 
             <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
           </tr>              
            
           <tr>
             <td class="main" valign="top"><b><?php echo TEXT_ENTRY; ?></b><br><?php echo tep_draw_textarea_field('entry_text', 'soft', '85', '15', $gInfo->entry_text); ?></td>
           </tr>
           <tr>
             <td class="smallText" align="center"><?php echo NOTE_ENTRY; ?></td>
           </tr>                 
     
		   <tr>
			 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
		   </tr>
		   <tr>
			 <td align="center" class="main"><?php echo tep_draw_hidden_field('entry_id', $gInfo->entry_id) . tep_draw_hidden_field('date_added', $gInfo->date_added) . tep_image_submit('button_preview.gif', IMAGE_PREVIEW) . ' <a href="' . tep_href_link(FILENAME_CONTEST, 'page=' . $_REQUEST['page'] . '&eID=' . $_REQUEST['eID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
		   </tr>
         </table></form></td>
       </tr>
      
<?php
  } elseif ($action == 'preview') {
    if (tep_not_null($_REQUEST)) {
      $gInfo = new objectInfo($_REQUEST);
    } else {
      $eID = tep_db_prepare_input($_REQUEST['eID']);

	  $contest_query = tep_db_query("select g.entry_id, g.contestants_name, g.contestants_email, g.contestants_location, g.entry_status, g.date_added, gd.entry_text, g.last_modified from " . TABLE_CONTEST . " g, " . TABLE_ENTER_CONTEST_DESCRIPTION . " gd where g.entry_id = '" . (int)$eID . "' and g.entry_id = gd.entry_id");
      $contest = tep_db_fetch_array($contest_query);
	   
	  $gInfo_array = array_merge($contest);
      $gInfo = new objectInfo($gInfo_array);	   
    }
?>
      <tr><?php echo tep_draw_form('update', 'index3.php?page=' . $_REQUEST['page'] . '&eID=' . $_REQUEST['eID'] . '&action=update', 'get', 'enctype="multipart/form-data"'); ?>
          <td><table border="0" width="95%" align="center" cellspacing="0" cellpadding="2">
              <tr> 
                <td class="main"><b><?php echo DISPLAY_ENTRY; ?></b> 
                  <?php 
 					if (!isset($gInfo->entry_status)) $gInfo->entry_status = '1';
     					switch ($gInfo->entry_status) {
      					case '0': $in_status = false; $out_status = true; echo ENTRY_NO; 
						break;
      					case '1':
      					default: $in_status = true; $out_status = false; echo ENTRY_YES;
    				}?>
                </td>
              </tr>
              <tr> 
                <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
              </tr>
              <tr> 
                <td class="main"><b><?php echo CONTESTANT_ENTRY; ?></b>&nbsp;&nbsp;&nbsp;<?php echo $gInfo->contestants_name; ?></td>
              </tr>
			  <tr> 
                <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
              </tr>
              <tr> 
                <td class="main"><b><?php echo EMAIL_ENTRY; ?></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo '<a href="' . tep_href_link(FILENAME_MAIL, 'selected_box=tools&customer=' . $gInfo->contestants_email) . '">' . $gInfo->contestants_email . '</a>'; ?></td>
              </tr>
			  <tr> 
                <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
              </tr>
              <tr> 
                <td class="main"><b><?php echo LOCATION_ENTRY; ?></b>&nbsp;&nbsp;&nbsp;<?php echo $gInfo->contestants_location; ?></td>
              </tr>
              <tr> 
                <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
              </tr>
              <tr> 
                <td class="main"><b><?php echo DATE_ENTRY; ?></b>&nbsp;&nbsp;<?php echo tep_date_long($gInfo->date_added); ?></td>
              </tr>
              <tr> 
                <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
              </tr>
            
          <tr>
            <td valign="top" class="main"><b><?php echo TEXT_ENTRY; ?></b><br><?php echo nl2br(tep_db_output(tep_break_string($gInfo->entry_text, 15))); ?></td>
          </tr>
        
        <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
      </tr>
<?php
    if (tep_not_null($_REQUEST)) {
/* Re-Post all POST'ed variables */
      reset($_REQUEST);
      while(list($key, $value) = each($_REQUEST)) 
      if ($key != 'action'){
      echo tep_draw_hidden_field($key, $value);
      }
?>
      
	  <tr>
	    <td align="center">&nbsp;&nbsp;&nbsp;&nbsp;<?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;&nbsp;&nbsp;&nbsp;<a href="' . tep_href_link(FILENAME_CONTEST, 'page=' . $_REQUEST['page'] . '&eID=' . $gInfo->entry_id . '&action=edit') . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a> <a href="' . tep_href_link(FILENAME_CONTEST, 'page=' . $_REQUEST['page'] . '&eID=' . $gInfo->entry_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
      </tr>
<?php
    } else {
      if (isset($_REQUEST['origin'])) {
        $back_url = $_REQUEST['origin'];
        $back_url_params = '';
      } else {
        $back_url = FILENAME_CONTEST;
        $back_url_params = 'page=' . $_REQUEST['page'] . '&eID=' . $gInfo->entry_id;
      }
?>
      <tr>
        <td align="right"><?php echo '<a href="' . tep_href_link($back_url, $back_url_params, 'NONSSL') . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
      </tr>
	  </tr>
        </table></form></td>
		</tr>
<?php
    }
  } else {
?>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="adminlist"><thead>
              <tr class="dataTableHeadingRow">
			  <th class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_TOOLS; ?></td>
                <th class="dataTableHeadingContent"><?php echo TABLE_HEADING_CONTESTANT; ?></td>
				<th class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_DATE_ADDED; ?></td>
                <th class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td>                
                <th class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
              </tr></thead>
<?php
    $contest_query_raw = "select entry_id, contestants_name, date_added, last_modified, entry_status from " . TABLE_CONTEST . " order by date_added DESC";
    $contest_split = new splitPageResults($_REQUEST['page'], MAX_DISPLAY_SEARCH_RESULTS, $contest_query_raw, $contest_query_numrows);
    $contest_query = tep_db_query($contest_query_raw);
    while ($contest = tep_db_fetch_array($contest_query)) {
      if ((!isset($_REQUEST['eID']) || (isset($_REQUEST['eID']) && ($_REQUEST['eID'] == $contest['entry_id']))) && !isset($gInfo)) {
       
	    $contest_text_query = tep_db_query("select g.contestants_email, g.contestants_location, gd.entry_text from "  . TABLE_CONTEST . " g, " . TABLE_ENTER_CONTEST_DESCRIPTION . " gd where g.entry_id = '" . (int)$contest['entry_id'] . "' and g.entry_id = gd.entry_id ");
        $contest_text = tep_db_fetch_array($contest_text_query);
		
		$contest_text_query_two = tep_db_query("select l.name as contest_languages_name from " . TABLE_LANGUAGES . " l, " . TABLE_CONTEST . " g, " . TABLE_ENTER_CONTEST_DESCRIPTION . " gd where g.entry_id = '" . (int)$contest['entry_id'] . "' and g.entry_id = gd.entry_id and l.languages_id = gd.languages_id");
        $contest_text_two = tep_db_fetch_array($contest_text_query_two);
		
		$contest_info = array_merge($contest_text, $contest_text_two);
        $gInfo_array = array_merge($contest, $contest_info);
        $gInfo = new objectInfo($gInfo_array);
      }

      if (isset($gInfo) && is_object($gInfo) && ($contest['entry_id'] == $gInfo->entry_id) ) {
        echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CONTEST, 'page=' . $_REQUEST['page'] . '&eID=' . $gInfo->entry_id . '&action=preview') . '\'">' . "\n";
      } else {
        echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CONTEST, 'page=' . $_REQUEST['page'] . '&eID=' . $contest['entry_id']) . '\'">' . "\n";
      }
?>
               <td class="dataTableContent">&nbsp;<?php echo '<a href="' . tep_href_link(FILENAME_CONTEST, 'page=' . $_REQUEST['page'] . '&eID=' . $gInfo->entry_id . '&action=delete') . '">' . tep_image(DIR_WS_IMAGES . 'icons/delete.gif', IMAGE_DELETE_CUSTOMER) . '</a> <a href="' . tep_href_link(FILENAME_MAIL, 'selected_box=tools&customer=' . $gInfo->contestants_email) . '">' . tep_image(DIR_WS_IMAGES . 'icons/send_mail.gif', IMAGE_SEND_EMAIL); ?></a> &nbsp;<?php echo '<a href="' . tep_href_link(FILENAME_CONTEST, 'page=' . $_REQUEST['page'] . '&eID=' . $contest['entry_id'] . '&action=preview') . '">' . tep_image(DIR_WS_IMAGES . 'icons/preview.gif', ICON_PREVIEW) . '</a>'; ?></td>
		       <td class="dataTableContent" align="left"><?php echo tep_get_contestants_name($contest['entry_id']); ?></td>
			   <td class="dataTableContent" align="right"><?php echo tep_date_long($contest['date_added']); ?></td>
               <td class="dataTableContent" align="right">
<?php
      if ($contest['entry_status'] == '1') {
        echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . '&nbsp;&nbsp;<a href="' . tep_href_link(FILENAME_CONTEST, 'action=setflag&flag=0&pID=' . $contest['entry_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '</a>';
      } else {
        echo '<a href="' . tep_href_link(FILENAME_CONTEST, 'action=setflag&flag=1&pID=' . $contest['entry_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '</a>&nbsp;&nbsp;' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10);
      }
?>
              </td>                
                <td class="dataTableContent" align="right"><?php if ( (is_object($gInfo)) && ($contest['entry_id'] == $gInfo->entry_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', IMAGE_CURRENT_SELECTION); } else { echo '<a href="' . tep_href_link(FILENAME_CONTEST, 'page=' . $_REQUEST['page'] . '&eID=' . $contest['entry_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
              </tr>
<?php
    }
?>
              <tr>
                <td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2">
                  <tr>
                    <td class="smallText" valign="top"><?php echo $contest_split->display_count($contest_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_REQUEST['page'], TEXT_DISPLAY_NUMBER_OF_CONTESTANTS); ?></td>
                    <td class="smallText" align="right"><?php echo $contest_split->display_links($contest_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, CONTEST_MAX_DISPLAY_PAGE_LINKS, $_REQUEST['page']); ?></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
<?php
    $heading = array();
    $contents = array();

    switch ($action) {
      case 'delete':
        $heading[] = array('text' => '&nbsp;<font color="0000FF"><b>' . TEXT_INFO_HEADING_DELETE_CONTESTANT . '</b></font>');

        $contents = array('form' => tep_draw_form('contest', 'index3.php?option=com_oscommerce&osMod=contest&page=' . $_REQUEST['page'] . '&eID=' . $gInfo->entry_id . '&action=deleteconfirm'));
        $contents[] = array('text' => '<br>&nbsp;' . TEXT_INFO_DELETE_CONTESTANT_INTRO);
        $contents[] = array('text' => '<br>&nbsp;<b>' . $gInfo->contestants_name . '</b>');
        $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_CONTEST, 'page=' . $_REQUEST['page'] . '&eID=' . $gInfo->entry_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a><br><br>');
        break;
      default:
      if (isset($gInfo) && is_object($gInfo)) {
        $heading[] = array('text' => '&nbsp;<font color="0000FF"><b>' . $gInfo->contestants_name . '</b></font>');

        $contents[] = array('align' => 'center', 'text' => '<br><a href="' . tep_href_link(FILENAME_CONTEST, 'page=' . $_REQUEST['page'] . '&eID=' . $gInfo->entry_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_CONTEST, 'page=' . $_REQUEST['page'] . '&eID=' . $gInfo->entry_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_MAIL, 'selected_box=tools&customer=' . $gInfo->contestants_email) . '">' . tep_image_button('button_email.gif', IMAGE_EMAIL) . '</a> <br><a href="' . tep_href_link(FILENAME_PRIZES) . '">' . tep_image_button('button_add_prize.gif', IMAGE_PRIZE_PRODUCTS) . '</a>');
        
		$contents[] = array('text' => '<br>&nbsp;' . '<b>' . TEXT_INFO_DATE_ADDED . ' ' . '</b>' . tep_date_short($gInfo->date_added));
        if (tep_not_null($gInfo->last_modified)) $contents[] = array('text' => '&nbsp;<b>' . TEXT_INFO_LAST_MODIFIED . ' ' . '</b>' . tep_date_short($gInfo->last_modified));
        //$contents[] = array('text' =>  '<b>' . TEXT_INFO_CONTESTANT_SIZE . ' '. '</b>' . $gInfo->contest_text_size . ' bytes');
		$contents[] = array('text' => '&nbsp;<b>' . TEXT_INFO_CONTESTANT_LANGUAGES_NAME . ' ' . '</b>' . $gInfo->contest_languages_name);
		
        $contents[] = array('text' => '<br>&nbsp;' . '<b>' . TEXT_INFO_CONTESTANT_AUTHOR . ' ' . '</b>' . $gInfo->contestants_name);
		$contents[] = array('text' => '&nbsp;<b>' . TEXT_INFO_CONTESTANT_EMAIL . ' ' . '</b>' . $gInfo->contestants_email . '<br><br>');
		$contents[] = array('text' => '&nbsp;<b>' . TEXT_INFO_CONTESTANT_LOCATION . ' ' . '</b>' . $gInfo->contestants_location);
		
		$contents[] = array('text' => '<br>&nbsp;<b>' . TEXT_INFO_CONTESTANT_ENTRY_TEXT . '</b>');
		$contents[] = array('text' => '&nbsp;<font color="330099">' . $gInfo->entry_text . '</font>'); 
	  } else {
		$heading[] = array('text' => '&nbsp;<b>' . TABLE_HEADING_ADD_PRIZE  . '</b>');

		$contents[] = array('align' => 'center', 'text' => '<br><a href="' . tep_href_link(FILENAME_PRIZES) . '">' . tep_image_button('button_add_prize.gif', IMAGE_PRIZE_PRODUCTS) . '</a><br><br>');        
      }
        break;
    }      

    if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
      echo '            <td width="25%" valign="top">' . "\n";

      $box = new box;
      echo $box->infoBox($heading, $contents);

      echo '            </td>' . "\n";
    }
?>
          </tr>
        </table></td>
      </tr>
<?php
  }
?>
    </table></td>
<!-- body_text_eof //-->
  </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->

<!-- footer_eof //-->
<br>
<?php
  require(DIR_WS_INCLUDES . 'application_bottom.php');

  // -- webMS Modification --
  // reset the Mambo Database connection (stomped by osCommerce Connection)
  if (!DB_SHARED) {
    global $database, $mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix;
    $database = new database( $mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix );
  }
?>